﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _7.ReverseDigits
{
    class ReverseDigits
    {
        static string NumberInReverse(int num)
        {
            StringBuilder numberReverse = new StringBuilder();
            while (num != 0)
            {
                int currentDigit = num % 10;
                int currentNumber = num / 10;
                num = currentNumber;

                numberReverse.Append(currentDigit);
            }

            return numberReverse.ToString();
        }

        static void Main()
        {
            int n = 512346;
            Console.WriteLine(NumberInReverse(n));
        }
    }
}
   
